//
//  UIBarButtonItem+CCYCreateItem.m
//  模拟-百思不得姐
//
//  Created by 程春玉 on 16/8/2.
//  Copyright © 2016年 chunyu. All rights reserved.
//

#import "UIBarButtonItem+CCYCreateItem.h"

@implementation UIBarButtonItem (CCYCreateItem)

+ (instancetype)itemWithImage:(NSString *)image selectImage:(NSString *)selectImage target:(id)target action:(SEL)action
{
    UIButton *btn = [UIButton buttonWithType:(UIButtonTypeCustom)];
    [btn setBackgroundImage:[UIImage imageNamed:image] forState:(UIControlStateNormal)];
    [btn setBackgroundImage:[UIImage imageNamed:selectImage] forState:(UIControlStateHighlighted)];
    btn.size = btn.currentBackgroundImage.size;
    [btn addTarget:target action:action forControlEvents:(UIControlEventTouchUpInside)];
    return [[self alloc] initWithCustomView:btn];
}


@end
